package controllers

import (
	"fmt"

	"github.com/astaxie/beego"
)

type FormController struct {
	beego.Controller
}

type User struct {
	Id       int    `form:"-"`
	Name     string `form:"name,text,名&nbsp称："`
	Path     string `form:"path,text,地&nbsp址："`
	UserName string `form:"username,text,用户名："`
	PassWord string `form:",password,密&nbsp码："`
}

func (c *FormController) Get() {
	//c.Data["Form"] = &User{}
	c.TplName = "list.tpl"
}

func (c *FormController) Post() {
	inputs := c.Input()
	fmt.Println(inputs.Get("name"))

	u := User{}
	if err := c.ParseForm(&u); err != nil {
		c.Ctx.WriteString("参数错误")
		return
	}

	//c.Ctx.WriteString(u.Name)
	//c.Ctx.WriteString(u.UserName)
}
